package com.zhaowei.allinpay.order;


import com.zhaowei.allinpay.DemoUtils;
import com.zhaowei.allinpay.IDemoHandler;
import org.json.JSONArray;
import org.json.JSONObject;

public class ConsumeApplyHandler implements IDemoHandler {
    @Override
    public JSONObject getRequestParams() throws Exception {
        DemoUtils rsa = new DemoUtils();
        String bizOrderNo = System.currentTimeMillis() + "xf";

        //新移动H5快捷支付
        JSONObject quickPayH5 = new JSONObject();
//        quickPayH5.put("bankCardNo", rsa.rsaEncrypt("6228480000666022208"));
        quickPayH5.put("amount", 10);

        //支付宝扫码
        JSONObject scanalipay = new JSONObject();
        scanalipay.put("payType","A01");
        scanalipay.put("amount",10L);

        //微信扫码支付
        JSONObject scanwxpay = new JSONObject();
        scanwxpay.put("payType","W01");
        scanwxpay.put("amount",2);

        JSONObject codepaya = new JSONObject();
        codepaya.put("amount",2);
        codepaya.put("authcode","280288311050353147");
        
        JSONObject gateway = new JSONObject();
        gateway.put("amount",50);
        gateway.put("bankCode","vbank");
        gateway.put("payType",1);
        
        //组装支付方式
        JSONObject payMethod = new JSONObject();
   //     payMethod.put("QUICKPAY_PC", quickPayH5);
   //     payMethod.put("BALANCE",balances);
     //   payMethod.put("CODEPAY_A",codepaya);
   //   payMethod.put("SCAN_ALIPAY",scanalipay);
//        payMethod.put("GATEWAY",gateway);
        payMethod.put("SCAN_WEIXIN",scanwxpay);

        JSONArray balances = new JSONArray();
        JSONObject balance = new JSONObject();
        balance.put("amount", 40);
        balance.put("accountSetNo","200001");
        balances.put(balance);

        JSONArray splitRule = new JSONArray();

        JSONObject splistRule1 = new JSONObject();
        splistRule1.put("bizUserId", "JCBANKPP010");
        splistRule1.put("amount", 50);
        splistRule1.put("fee", 0L);
        splistRule1.put("remark", "aaaaa");

        splitRule.put(splistRule1);

        JSONObject param = new JSONObject();
        param.put("payerId", "zhanxh");
        //param.put("recieverId", "allinpay3502");
        param.put("recieverId", "100009001000");
        param.put("bizOrderNo", bizOrderNo);
        param.put("amount", 2);
        param.put("fee", 0);
        param.put("validateType", 1);
//        param.put("splitRule", );
        param.put("frontUrl", "http://122.227.225.142:23661/gateway/getPayFront.jsp");
        param.put("backUrl", "http://ts1.duyinwang.com/allInPay/notifyurl");
//        param.put("ordErexpireDatetime", );
        param.put("payMethod", payMethod);
        param.put("goodsName", "test_goodsName");
        param.put("goodsDesc", "test_goodsDesc");
        param.put("industryCode", "1010");
        param.put("industryName", "印刷行业");
        param.put("source", 2);
        param.put("summary", "testtest_summar");
//        param.put("extendInfo",);


        return param;
    }
}
